#ifndef _MQTT_H__
#define _MQTT_H__

#include "main.h"
#include <MQTTClient.h>

#define FSL_MQTT_ 1
#define ADDRESS     "ssl://brambling-device.chinafsl.com:21005"

#define CLIENTID    "0ft1sbe6856j39ef"                  // 这个没用到
#define USERNAME    "PLCGW-0ft1sbe"
#define PASSWORD    "p40UPQZ36M5s9275"

#define PAYLOAD     "Hello MQTT!"

#define QOS         1
#define TIMEOUT     10000L


#define MAX_MQTT_PAYLOAD_SIZE 1024

typedef struct 
{
    int payloadlen;
    char payload[MAX_MQTT_PAYLOAD_SIZE];
} mqtt_message_t;


//只需订阅这个主题，根据云端请求的再作区分
#define FSL_Mqtt_Get        "/hz/user/get"
//获取列表
#define FSL_Mqtt_List_Project "/hz/list/project"
#define FSL_Mqtt_List_Space "/hz/list/space"
#define FSL_Mqtt_List_Region "/hz/list/region"
#define FSL_Mqtt_List_Group "/hz/list/group"
#define FSL_Mqtt_List_Scene "/hz/list/scene"
#define FSL_Mqtt_List_Device "/hz/list/device"
//获取详情
#define FSL_Mqtt_Detail_Project "/hz/detail/project"
#define FSL_Mqtt_Detail_Space "/hz/detail/space"
#define FSL_Mqtt_Detail_Region "/hz/detail/region"
#define FSL_Mqtt_Detail_Group "/hz/detail/group"
#define FSL_Mqtt_Detail_Scene "/hz/detail/scene"
#define FSL_Mqtt_Detail_Device "/hz/detail/device"
//状态上报
#define FSL_Mqtt_Status_Project "/hz/status/project"
#define FSL_Mqtt_Status_Space "/hz/status/space"
#define FSL_Mqtt_Status_Region "/hz/status/region"
#define FSL_Mqtt_Status_Group "/hz/status/group"
#define FSL_Mqtt_Status_Scene "/hz/status/scene"
#define FSL_Mqtt_Status_Device "/hz/status/device"
//修改配置
#define FSL_Mqtt_Modify_Project "/hz/modify/project"
#define FSL_Mqtt_Modify_Space "/hz/modify/space"
#define FSL_Mqtt_Modify_Region "/hz/modify/region"
#define FSL_Mqtt_Modify_Group "/hz/modify/group"
#define FSL_Mqtt_Modify_Scene "/hz/modify/scene"
#define FSL_Mqtt_Modify_Device "/hz/modify/device"
//远程控制
#define FSL_Mqtt_Control_Project "/hz/control/project"
#define FSL_Mqtt_Control_Space "/hz/control/space"
#define FSL_Mqtt_Control_Region "/hz/control/region"
#define FSL_Mqtt_Control_Group "/hz/control/group"
#define FSL_Mqtt_Control_Scene "/hz/control/scene"
#define FSL_Mqtt_Control_Device "/hz/control/device"
//获取日志
#define FSL_Mqtt_Log_Project "/hz/log/project"
#define FSL_Mqtt_Log_Space "/hz/log/space"
#define FSL_Mqtt_Log_Region "/hz/log/region"
#define FSL_Mqtt_Log_Group "/hz/log/group"
#define FSL_Mqtt_Log_Scene "/hz/log/scene"
#define FSL_Mqtt_Log_Device "/hz/log/device"
//获取能耗
#define FSL_Mqtt_Energy_ALL "/hz/energy/all"
#define FSL_Mqtt_Energy_Project "/hz/energy/project"
#define FSL_Mqtt_Energy_Space "/hz/energy/space"
#define FSL_Mqtt_Energy_Region "/hz/energy/region"
#define FSL_Mqtt_Energy_Group "/hz/energy/group"
#define FSL_Mqtt_Energy_Device "/hz/energy/device"
//设备事件
#define FSL_Mqtt_Event_Message "/hz/event/message"
#define FSL_Mqtt_Event_Alert "/hz/event/alert"
#define FSL_Mqtt_Event_Fault "/hz/event/fault"






extern void  FSL_Mqtt_Init(void);
extern void FSL_Mqtt_Handle_Control_Device(cJSON *json);
extern void FSL_Mqtt_Report(const char *shortaddr);




#endif
